package com.bajiao.common.util;


import java.text.NumberFormat;

//10.1   10   10.11   这几种类型的元转为没有小数的分（小数点后面的小于等于2位）
public class YuanCastFenUtil {

    public static void main(String[] args) {
        Double a=100003.00;
        cast(a);
    }

    public static String cast(double money){
        NumberFormat NF = NumberFormat.getInstance();
        NF.setGroupingUsed(false);//去掉科学计数法显示
        String moneyFen = String.valueOf(NF.format(money*100));
        String replace = moneyFen.replace('.', ',');
        String[] str = replace.split(",");
        return str == null?moneyFen:str[0];
    }

    public static String cast(String money){
        NumberFormat NF = NumberFormat.getInstance();
        NF.setGroupingUsed(false);//去掉科学计数法显示
        String moneyFen = String.valueOf(NF.format(Double.parseDouble(money)*100));
        String replace = moneyFen.replace('.', ',');
        String[] str = replace.split(",");
        return str == null?moneyFen:str[0];
    }
}
